<template name="BottomBar">
	<view class="bottom">
		<view class="bottom-left">
			<image :src="musicItems.pic"  @tap="goPlay" ></image>
			<view class="audio-info" @tap="goPlay">
				<view class="audio-name">
					{{musicItems.name?musicItems.name:'暂无'}}
					
				</view>
				<view class="audio-singer">
					{{musicItems.artist?musicItems.artist:'暂无'}}
				</view>
			</view>
		</view>
		<view class="bottom-right">
			<view class="btn-player">
				<!-- @tap="goPlay" -->
				<view class="text-black" >
					<image src="../../static/images/playBarImg/play.png" alt="" v-if="!musicItems.isplay" @click="playMusic(musicItems)">
					<image src="../../static/images/playBarImg/pause.png" alt="" v-else @click="pauseMusic">
				</view>
			</view>
			<view class="btn-info">
				<view class="text-black">
					<image src="../../static/images/playBarImg/list.png" alt="">
				</view>
			</view>
		</view>
	</view>
</template>

<script>

	export default {
		name: "BottomBar",
		props:{musicItems:Object},
		data() {
			return{
				
			}
		},
		methods:{
			goPlay(){
				// uni.navigateTo({
				// 	url: '../../pages/play/play'
				// })
			},
			// 播放音乐
			playMusic(){

				if(uni.getStorageSync("currentPlaySongPage") === "searchSong"){
					uni.$emit("controlSearchMusic","playMusic",uni.getStorageSync("currentPlayItem"))
				}
				else if(uni.getStorageSync("currentPlaySongPage") === "recommendSong"){
					uni.$emit("controlRecommendMusic","playMusic",uni.getStorageSync("currentPlayItem"))
				}
				else if(uni.getStorageSync("currentPlaySongPage") === "indexSong"){
					uni.$emit("controlIndexMusic","playMusic",uni.getStorageSync("currentPlayItem"))
				}
				uni.$emit("controlIndexMusic","refreshMusicStatus")
				uni.$emit("controlSearchMusic","refreshMusicStatus")
				uni.$emit("controlRecommendMusic","refreshMusicStatus")
			},
			//暂停音乐
			 pauseMusic(){
				 if(uni.getStorageSync("currentPlaySongPage") === "searchSong"){
					 uni.$emit("controlSearchMusic","pauseMusic")
				 }
				 else if(uni.getStorageSync("currentPlaySongPage") === "recommendSong"){
				 	uni.$emit("controlRecommendMusic","pauseMusic")
				 }
				 else if(uni.getStorageSync("currentPlaySongPage") === "indexSong"){
				 	 uni.$emit("controlIndexMusic","pauseMusic",uni.getStorageSync("currentPlayItem"))
				 }
				
				 uni.$emit("controlIndexMusic","refreshMusicStatus")
				 uni.$emit("controlSearchMusic","refreshMusicStatus")
				 uni.$emit("controlRecommendMusic","refreshMusicStatus")
			 },
		},
		onReady() {
			
		}
		
	}
</script>

<style>
	@import url("./index.css");
</style>
